<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<title>申请加入</title>
		<link rel="stylesheet" type="text/css" href="../../css/aui-win.css" />
<style>
            /*中间主体部分CSS开始*/
*{margin: 0;padding: 0;}
.warnInfo{background: #B3B3B3;height: 40px;width: 100%;color:#333;font-size:14px;}
.warnInfo p{text-align:center;font-size:13px;height: 40px;line-height: 40px;}
.mainDiv {text-align:center; margin-top: 30px;}
.mainDiv > div{height: 50px;}
.mainDiv > div span {font-size: 16px;color:black;}
.mainDiv > div input[type="text"] {border: none;border-bottom: 1px solid #666;width: 60%;padding-left: 10px;font-size:16px;background:none;}
#industrys {width: 65%;}
.subBtn {line-height: 35px;text-align: center;display: block;height: 35px;width: 90%;margin-left: 5%;font-size: 14px;color: rgba(255,255,255,1);border: 1px solid rgba(0,0,0,0.2);background-color: #00ABFD;border-radius: 5px;-webkit-border-radius: 5px;-moz-border-radius: 5px;margin-top: 5px;text-align: center;}
</style>
	</head>
	<body>
		<header class="aui-bar aui-bar-nav aui-bar-yunzo" id="aui-header">
		<a class="aui-btn aui-bar-yunzo aui-pull-left" id="back" onclick="back_go()"> <span class="aui-iconfont aui-icon-left"></span></a>
		<div class="aui-title" id="title">
			申请加入
		</div>
		<a class="aui-iconfont aui-icon-menu aui-pull-right"></a>
	</header>
	<div class="margin_div"></div>
        <div class="content">
            <div class="warnInfo">
                <p>
                    申请加入<span id="groupName"></span>，请您完善信息
                </p>
            </div>
            <div class="mainDiv">
                <div>
                    <span>姓&emsp;&emsp;名:</span>
                    <input id="name" type="text" placeholder="请输入您的姓名" />
                </div>
                <div>
                    <span>电&emsp;&emsp;话:</span>
                    <input id="tel" type="text" placeholder="请输入您的电话号码"/>
                </div>
                <div>
                    <span>公司名称:</span>
                    <input id="companyName" type="text" placeholder="请输入您的公司名称"/>
                </div>
                <div>
                    <span>公司职务:</span>
                    <select id="industrys">
                        <option value ="1">总经理</option>
                        <option value ="2">副总经理</option>
                        <option value="3">总监</option>
                        <option value="4">部门经理</option>
                        <option value="5">部门主管</option>
                        <option value="6">员工</option>
                        
                    </select>
                </div>
                <div>
                    <span>区&emsp;&emsp;域:</span>
                    <input id="txtcity" type="text" placeholder="成都">
                </div>
                <textarea id="applyReason" style="width: 94.5%;height: 100px;padding-left:2.5%;padding-top:5px;" placeholder="请输入申请理由"></textarea>
            </div>
            <div>
                <input class="subBtn" type="button" value="提交" onclick="subClick()" />
            </div>
        </div>
	</body>
	<script type="text/javascript" src="../../script/jquery-1.10.2.min.js"></script>
    <script src="../../script/common.js"></script>
    <script>
        $("#back").attr("href","javascript:window.history.go(-1);");
        $("#groupName").html(window.localStorage.currentGroupName);
        sTart_Stop();
        function subClick() {
            var baseData = basedata(initdata.get('groupinfo'));
            var bodyParam = {
                mname: $("#name").val(),
                tellphone: $("#tel").val(),
                companyname: $("#companyName").val(),
                companyduty: $("#industrys").val(),
                comaddress: $("#txtcity").val(),
                joinjustly: $("#applyReason").val(),
                joingroupid: $groupid,
                mid: $mid,
                groupid: $groupid,
                did: initdata.get('groupinfo')
            };
            var nameLen =  $("#name").val().replace(/[\u4e00-\u9fa5]/g,"xx").length;
            var companyNameLen =  $("#companyName").val().replace(/[\u4e00-\u9fa5]/g,"xx").length;
            var txtcityLen =  $("#txtcity").val().replace(/[\u4e00-\u9fa5]/g,"xx").length;
            var applyReasonLen =  $("#applyReason").val().replace(/[\u4e00-\u9fa5]/g,"xx").length;
            if(nameLen>=4  && nameLen<12 && _checkPhone($("#tel").val())
                && companyNameLen>=2 && txtcityLen>=2
                && applyReasonLen>=6 )
            {
                ajaxCoCRequest("../../../api/group/applyforjoingroup","post",bodyParam,function(msg){
                    if(msg.code==100){
                        alert("申请成功，等待审核通过！")
                    }else{
                    	$("body").append('<div class="wuwang"><img src="../../image/iconfont-wangluo.png"><p>网络拥堵，信息塞车</p></div>')
                    }
                });
            }else{
                var alertMsg="";
                if(nameLen<4){ alertMsg += "姓名最少为2个字\n"; }
                if(nameLen>=8){ alertMsg += "姓名过长，请修改\n";  }
                if(!_checkPhone($("#tel").val())){ alertMsg += "电话号码格式有误\n"; }
                if(companyNameLen<2){ alertMsg += "公司名称至少为2个字\n";}
                if(txtcityLen<2){  alertMsg += "区域名称至少为2个字\n"; }
                if(applyReasonLen<6){ alertMsg += "申请理由至少为6个字\n"; }
                alert(alertMsg);
            }
        }
    </script>
</html>